<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类型转换</title>
    <style>
        *{margin: 0;padding: 0;list-style-type: none;}
    </style>
</head>
<body>
    <script>
        //转换为数字类型
        //Number()

        //转换为布尔类型
        //boolean()

        //以下几种转换布尔类型时会被转为false,其余的都为true
        console.log(Boolean(false));
        console.log(Boolean(0));
        console.log(Boolean(0n));
        console.log(Boolean(undefined));
        console.log(Boolean(null));
        console.log(Boolean(""));
        console.log(Boolean(NaN));
        
    </script>
</body>
</html>